﻿using System;
using System.Windows.Forms;
using MediaLibraryManagement.BLL;
using MediaLibraryManagement.Common;
using MediaLibraryManagement.Entity;

namespace MediaLibraryManagement.UI
{
    public partial class MovieInfoPane : UserControl
    {
        private Movie _movie;

        public MovieInfoPane()
        {
            InitializeComponent();
        }

        public Movie Movie
        {
            get { return _movie; }
            set { _movie = value; }
        }

        private void MovieInfoPane_Load(object sender, EventArgs e)
        {
            if (_movie != null)
            {
                lblTitle.Text += _movie.Title;
                lblGenre.Text += _movie.Genre;
                lblLength.Text += _movie.Length + " phút";
                picMovieImage.Image = Utilities.ScaleImage(_movie.Image, picMovieImage.Width, picMovieImage.Height);
            }
        }

        private void lnkViewDetails_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (_movie != null)
            {
                _movie = (new MovieBLL()).GetMovieByID(_movie.ID);
                MovieDetails frmMovieDetails = new MovieDetails(_movie);
                frmMovieDetails.ShowDialog();
            }
        }
    }
}